//
//  OrderDocMes.m
//  QuickCure
//
//  Created by 源 何 on 16/9/15.
//  Copyright © 2016年 haoge. All rights reserved.
//

//define this constant if you want to use Masonry without the 'mas_' prefix
#define MAS_SHORTHAND

//define this constant if you want to enable auto-boxing for default syntax
#define MAS_SHORTHAND_GLOBALS

#import "OrderDocMes.h"

@interface OrderDocMes ()

@property (nonatomic, strong) NSArray *messArray;

@end

@implementation OrderDocMes

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"预约医生信息详情";
    
    _messArray = [self.pMess componentsSeparatedByString:@"   "];

    //第一个view
    UIView *firstView = [[UIView alloc] init];
    firstView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:firstView];
    
#pragma
#pragma mark -- 第一个view中的内容
    UIImageView *icon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"banner"]];
    [firstView addSubview:icon];
    
    UILabel *pName = [[UILabel alloc] init];
    pName.text = _messArray[0];
    pName.font = [UIFont systemFontOfSize:19];
    pName.textColor = [UIColor blackColor];
    [firstView addSubview:pName];
    
    UILabel *pIllness = [[UILabel alloc] init];
    pIllness.text = _messArray[1];
    pIllness.font = [UIFont systemFontOfSize:18];
    pIllness.textColor = [UIColor colorWithRed:0.6667 green:0.6667 blue:0.6667 alpha:1.0];
    [firstView addSubview:pIllness];
    
    UILabel *pTime = [[UILabel alloc] init];
    pTime.text = _messArray[2];
    pTime.font = [UIFont systemFontOfSize:18];
    pTime.textColor = [UIColor colorWithRed:0.6667 green:0.6667 blue:0.6667 alpha:1.0];
    [firstView addSubview:pTime];
    
    UIView *roundView = [[UIView alloc] init];
    roundView.layer.cornerRadius = 33;
    roundView.clipsToBounds = YES;
    roundView.backgroundColor = [UIColor colorWithRed:0.1412 green:0.4784 blue:0.6667 alpha:1.0];
    [firstView addSubview:roundView];
    
    UILabel *pState = [[UILabel alloc] init];
    pState.text = _messArray[3];
    pState.font = [UIFont systemFontOfSize:18];
    pState.textColor = [UIColor whiteColor];
    [roundView addSubview:pState];
    
    //灰色的view1
    UIView *lineView1 = [[UIView alloc] init];
    lineView1.backgroundColor = [UIColor colorWithRed:0.6667 green:0.6667 blue:0.6667 alpha:1.0];
    [self.view addSubview:lineView1];
    
    //第二个view
    UIView *secView = [[UIView alloc] init];
    secView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:secView];
    
    UILabel *orderDC = [[UILabel alloc] init];
    orderDC.text = @"预约医生:";
    orderDC.textColor = [UIColor colorWithRed:0.6667 green:0.6667 blue:0.6667 alpha:1.0];
    orderDC.font = [UIFont systemFontOfSize:20];
    [secView addSubview:orderDC];
    
    //灰色的view2
    UIView *lineView2 = [[UIView alloc] init];
    lineView2.backgroundColor = [UIColor colorWithRed:0.6667 green:0.6667 blue:0.6667 alpha:1.0];
    [self.view addSubview:lineView2];
    
    //第三个view
    UIView *thirdView = [[UIView alloc] init];
    thirdView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:thirdView];
    
    UILabel *dName = [[UILabel alloc] init];
    dName.text = @"马医生";
    dName.font = [UIFont systemFontOfSize:19];
    dName.textColor = [UIColor blackColor];
    [thirdView addSubview:dName];
    
    UILabel *dPosition = [[UILabel alloc] init];
    dPosition.text = @"主任医生";
    dPosition.font = [UIFont systemFontOfSize:19];
    dPosition.textColor = [UIColor colorWithWhite:0.6667 alpha:1.0];
    [thirdView addSubview:dPosition];
    
    UILabel *dHospital = [[UILabel alloc] init];
    dHospital.text = @"上海长征医院";
    dHospital.font = [UIFont systemFontOfSize:19];
    dHospital.textColor = [UIColor colorWithWhite:0.6667 alpha:1.0];
    [thirdView addSubview:dHospital];
    
    UIView *greenView = [[UIView alloc] init];
    greenView.backgroundColor = [UIColor colorWithRed:0.0941 green:0.7373 blue:0.7333 alpha:1.0];
    greenView.layer.cornerRadius = 3;
    greenView.clipsToBounds = YES;
    [thirdView addSubview:greenView];
    
    UILabel *greenLabel = [[UILabel alloc] init];
    greenLabel.text = @"递交反馈";
    greenLabel.textColor = [UIColor whiteColor];
    greenLabel.font = [UIFont systemFontOfSize:19];
    [greenView addSubview:greenLabel];
    
    //灰色的view3
    UIView *lineView3 = [[UIView alloc] init];
    lineView3.backgroundColor = [UIColor colorWithRed:0.6667 green:0.6667 blue:0.6667 alpha:1.0];
    [self.view addSubview:lineView3];
    
    //第四个view
    UIView *fourView = [[UIView alloc] init];
    fourView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:fourView];
    
    UILabel *orderInfo = [[UILabel alloc] init];
    orderInfo.text = @"预约须知:";
    orderInfo.textColor = [UIColor colorWithRed:0.6667 green:0.6667 blue:0.6667 alpha:1.0];
    orderInfo.font = [UIFont systemFontOfSize:20];
    [fourView addSubview:orderInfo];
    
    //灰色的view4
    UIView *lineView4 = [[UIView alloc] init];
    lineView4.backgroundColor = [UIColor colorWithRed:0.6667 green:0.6667 blue:0.6667 alpha:1.0];
    [self.view addSubview:lineView4];
    
    //第五个view
    UIView *fiveView = [[UIView alloc] init];
    fiveView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:fiveView];
    
    UILabel *firstPlaceLabel = [[UILabel alloc] init];
    firstPlaceLabel.text = @"就诊地点:";
    firstPlaceLabel.textColor = [UIColor blackColor];
    firstPlaceLabel.font = [UIFont systemFontOfSize:17];
    [fiveView addSubview:firstPlaceLabel];
    
    UILabel *firstPlace = [[UILabel alloc] init];
    firstPlace.text = @"上海长征医院2号楼心血管内科";
    firstPlace.textColor = [UIColor colorWithWhite:0.6667 alpha:1.0];
    firstPlace.font = [UIFont systemFontOfSize:17];
    [fiveView addSubview:firstPlace];
    
    UILabel *secTimeLabel = [[UILabel alloc] init];
    secTimeLabel.text = @"取号时间:";
    secTimeLabel.textColor = [UIColor blackColor];
    secTimeLabel.font = [UIFont systemFontOfSize:17];
    [fiveView addSubview:secTimeLabel];
    
    UILabel *secTime = [[UILabel alloc] init];
    secTime.text = @"9:00 - 10.00";
    secTime.textColor = [UIColor colorWithWhite:0.6667 alpha:1.0];
    secTime.font = [UIFont systemFontOfSize:17];
    [fiveView addSubview:secTime];
    
    UILabel *thirdPlaceLabel = [[UILabel alloc] init];
    thirdPlaceLabel.text = @"取号地址:";
    thirdPlaceLabel.textColor = [UIColor blackColor];
    thirdPlaceLabel.font = [UIFont systemFontOfSize:17];
    [fiveView addSubview:thirdPlaceLabel];
    
    UILabel *thirdPlace = [[UILabel alloc] init];
    thirdPlace.text = @"上海长征医院住院部";
    thirdPlace.textColor = [UIColor colorWithWhite:0.6667 alpha:1.0];
    thirdPlace.font = [UIFont systemFontOfSize:17];
    [fiveView addSubview:thirdPlace];
    
    //灰色的view5
    UIView *lineView5 = [[UIView alloc] init];
    lineView5.backgroundColor = [UIColor colorWithRed:0.6667 green:0.6667 blue:0.6667 alpha:1.0];
    [self.view addSubview:lineView5];
    
    //底部的view
    UIView *bottom1 = [[UIView alloc] init];
    bottom1.backgroundColor = [UIColor colorWithRed:0.0941 green:0.7373 blue:0.7333 alpha:1.0];
    bottom1.layer.cornerRadius = 5;
    bottom1.clipsToBounds = YES;
    [self.view addSubview:bottom1];
    
    UIView *centerView1 = [[UIView alloc] init];
    centerView1.backgroundColor = [UIColor whiteColor];
    centerView1.layer.cornerRadius = 4;
    centerView1.clipsToBounds = YES;
    [bottom1 addSubview:centerView1];
    
    UILabel *centerLabel1 = [[UILabel alloc] init];
    centerLabel1.text = @"短信重发";
    centerLabel1.font = [UIFont systemFontOfSize:20];
    centerLabel1.textColor = [UIColor colorWithWhite:0.5059 alpha:1.0];
    [centerView1 addSubview:centerLabel1];
    
    UIView *bottom2 = [[UIView alloc] init];
    bottom2.backgroundColor = [UIColor colorWithRed:0.0941 green:0.7373 blue:0.7333 alpha:1.0];
    bottom2.layer.cornerRadius = 5;
    bottom2.clipsToBounds = YES;
    [self.view addSubview:bottom2];
    
    UIView *centerView2 = [[UIView alloc] init];
    centerView2.backgroundColor = [UIColor whiteColor];
    centerView2.layer.cornerRadius = 4;
    centerView2.clipsToBounds = YES;
    [bottom2 addSubview:centerView2];
    
    UILabel *centerLabel2 = [[UILabel alloc] init];
    centerLabel2.text = @"取消预约";
    centerLabel2.font = [UIFont systemFontOfSize:20];
    centerLabel2.textColor = [UIColor colorWithWhite:0.5059 alpha:1.0];
    [centerView2 addSubview:centerLabel2];
    
#pragma
#pragma mark -- 设置约束
    //第一个view
    [firstView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(self.view).offset(64);
        make.height.equalTo(self.view).multipliedBy(0.143);
    }];
    
    [icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(firstView);
        make.width.height.equalTo(firstView.mas_height).multipliedBy(0.6);
        make.leading.equalTo(firstView).offset(20);
    }];
    
    [pName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(firstView).multipliedBy(0.7);
        make.leading.equalTo(icon.mas_trailing).offset(17);
    }];
    
    [pIllness mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(pName);
        make.leading.equalTo(pName.mas_trailing).offset(17);
    }];
    
    [pTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(firstView).multipliedBy(1.35);
        make.leading.equalTo(pName);
    }];
    
    [roundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(firstView);
        make.width.height.equalTo(firstView.mas_height).multipliedBy(0.7);
        make.trailing.equalTo(firstView.mas_trailing).offset(-20);
    }];
    
    [pState mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(roundView);
    }];
    
    //灰色view1
    [lineView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(firstView.mas_bottom);
        make.height.equalTo(@1);
    }];
    
    //第二个view
    [secView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(lineView1.mas_bottom);
        make.height.equalTo(self.view).multipliedBy(0.07);
    }];
    
    [orderDC mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(secView);
        make.leading.equalTo(secView).offset(17);
    }];
    
    //灰色view2
    [lineView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(secView.mas_bottom);
        make.height.equalTo(@1);
    }];
    
    //第三个view
    [thirdView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(lineView2.mas_bottom);
        make.height.equalTo(self.view).multipliedBy(0.143);
    }];
    
    [dName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(thirdView).multipliedBy(0.6);
        make.leading.equalTo(thirdView).offset(17);
    }];
    
    [dPosition mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(dName);
        make.leading.equalTo(dName.mas_trailing).offset(15);
    }];
    
    [dHospital mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(thirdView).multipliedBy(1.4);
        make.leading.equalTo(thirdView).offset(17);
    }];
    
    [greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(thirdView);
        make.height.equalTo(thirdView).multipliedBy(0.4);
        make.trailing.equalTo(thirdView).offset(-20);
        make.width.equalTo(@80);
    }];
    
    [greenLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(greenView);
    }];
    
    //灰色view3
    [lineView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(thirdView.mas_bottom);
        make.height.equalTo(@1);
    }];
    
    //第四个view
    [fourView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(lineView3.mas_bottom);
        make.height.equalTo(self.view).multipliedBy(0.07);
    }];
    
    [orderInfo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(fourView);
        make.leading.equalTo(fourView).offset(17);
    }];
    
    //灰色view4
    [lineView4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(fourView.mas_bottom);
        make.height.equalTo(@1);
    }];
    
    //第五个view
    [fiveView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(lineView4.mas_bottom);
        make.height.equalTo(self.view).multipliedBy(0.191);
    }];
    
    [firstPlaceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(fiveView).multipliedBy(0.4);
        make.leading.equalTo(fiveView).offset(17);
    }];
    
    [firstPlace mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(firstPlaceLabel);
        make.leading.equalTo(firstPlaceLabel.mas_trailing).offset(20);
    }];
    
    [secTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(fiveView);
        make.leading.equalTo(firstPlaceLabel);
    }];
    
    [secTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(secTimeLabel);
        make.leading.equalTo(secTimeLabel.mas_trailing).offset(20);
    }];
    
    [thirdPlaceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(fiveView).multipliedBy(1.6);
        make.leading.equalTo(firstPlaceLabel);
    }];
    
    [thirdPlace mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(thirdPlaceLabel);
        make.leading.equalTo(thirdPlaceLabel.mas_trailing).offset(20);
    }];

    
    //灰色view5
    [lineView5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(fiveView.mas_bottom);
        make.height.equalTo(@1);
    }];
    
    [bottom1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view).multipliedBy(0.5);
        make.bottom.equalTo(self.view).offset(-20);
        make.width.equalTo(self.view).multipliedBy(0.4);
        make.height.equalTo(@45);
    }];
    
    [centerView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.top.equalTo(bottom1).offset(1);
        make.trailing.bottom.equalTo(bottom1).offset(-1);
    }];
    
    [centerLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(centerView1);
    }];
    
    [bottom2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view).multipliedBy(1.5);
        make.bottom.equalTo(self.view).offset(-20);
        make.width.equalTo(self.view).multipliedBy(0.4);
        make.height.equalTo(@45);
    }];
    
    [centerView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bottom2).offset(1);
        make.leading.equalTo(bottom2).offset(0.5);
        make.bottom.equalTo(bottom2).offset(-1);
        make.trailing.equalTo(bottom2).offset(-1.5);
    }];
    
    [centerLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(centerView2);
    }];
    
}



@end
